<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>数字矩阵</title>
    <script>
      let sum = 1
      let num = 1
      let n = 2
      while (n < 1001) {
        //计算四个角值
        num += n
        //累加到总和上
        sum += num
        num += n
        sum += num
        num += n
        sum += num
        num += n
        sum += num
        //修改差值
        n += 2
      }
      document.write(sum)
    </script>
  </head>
  <body></body>
</html>
